<template>
  <div class='component'>
    <Row>
      <Col span="24">
        <Alert show-icon>我的眼睛望着窗外</Alert>
        <DatePicker type="daterange" :options="options2" placement="bottom-end" placeholder="选择日期" style="width: 200px;float: right;"></DatePicker>
      </Col>
    </Row>
    <Tabs value="name1">
      <TabPane label="月付" name="name1">
        <Table border :columns="columns7" :data="data6"></Table>
        <div style="margin: 10px;overflow: hidden">
          <div style="float: right;">
            <Page :total="50" show-total :current="1" @on-change="changePage"></Page>
          </div>
        </div>
      </TabPane>
      <TabPane label="季付" name="name2">季付</TabPane>
      <TabPane label="年付" name="name3">年付</TabPane>
    </Tabs>
  </div>
</template>
<script>
export default {
  name: 'order_list',
  data () {
    return {
      options2: {
        shortcuts: [
          {
            text: '1 week',
            value () {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
              return [start, end]
            }
          },
          {
            text: '1 month',
            value () {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
              return [start, end]
            }
          },
          {
            text: '3 months',
            value () {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
              return [start, end]
            }
          }
        ]
      },
      columns7: [
        {
          title: '淘宝昵称',
          key: 'name',
          render: (h, params) => {
            return h('div', [
              h('Icon', {
                props: {
                  type: 'person'
                }
              }),
              h('strong', params.row.name)
            ])
          }
        },
        {
          title: '交易金额',
          key: 'age'
        },
        {
          title: '交易时间',
          key: 'address'
        },
        {
          title: '操作',
          key: 'action',
          width: 150,
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h('Button', {
                props: {
                  type: 'primary',
                  size: 'small'
                },
                style: {
                  marginRight: '5px'
                },
                on: {
                  click: () => {
                    this.show(params.index)
                  }
                }
              }, '查看详情')
            ])
          }
        }
      ],
      data6: [
        {
          name: 'John Brown',
          age: 18,
          address: '2019-08-26'
        },
        {
          name: 'Jim Green',
          age: 24,
          address: '2019-08-26'
        },
        {
          name: 'Joe Black',
          age: 30,
          address: '2019-08-26'
        },
        {
          name: 'Jon Snow',
          age: 26,
          address: '2019-08-26'
        }
      ]
    }
  },
  methods: {
    show (index) {
      this.$Modal.info({
        title: '订单详情',
        content: `昵称：${this.data6[index].name}<br>交易金额：${this.data6[index].age}<br>交易时间：${this.data6[index].address}`
      })
    },
    remove (index) {
      this.data6.splice(index, 1)
    }
  }
}
</script>
